<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="${staticServer}/inc/style/main.css" />
<link rel="stylesheet" href="${staticServer}/inc/style/page.css" />
<link rel="stylesheet" href="${staticServer}/css/work_today.css" />
<link rel="stylesheet" href="${staticServer}/inc/style/date/datepicker.css" />
<link rel="stylesheet" href="${staticServer}/css/consultant_client_tracking.css" />
<script src="${staticServer}/inc/js/jquery.js"></script>
<script src="${staticServer}/inc/js/pageset.js"></script>
<script src="${staticServer}/inc/js/submitter.js"></script>
<script src="${staticServer}/inc/js/tips.js"></script>
<script src="${staticServer}/inc/js/datepicker.js"></script>
<script src="${staticServer}/js/web/consultant_client_tracking_list.js?1.0"></script>
<script src="${staticServer}/js/web/system_reception_list.js?1.2"></script>
<script>
var contextPath='${contextPath}';

function starquery()
{
	var url = "";
	var param_str = "";

		var sdate = $("#start_date").val();
		var edate = $("#end_date").val();
		var type = $("#type").val();
		if(sdate>edate){
			alert("选择日期出错。请重新选择！");
			$("#start_date").val(" ");
			$("#end_date").val(" ");
			return;
		}
		var params = [];
		if(!empty(sdate)) params.push("sdate=" + sdate);
		if(!empty(edate)) params.push("edate=" + edate);
		if(!empty(type)) params.push("type=" + type);
		url = "?" + params.join("&");
		location.href = "${contextPath}/oa/receptionXz.htm"+url;
}

function download(){
		var sdate = $("#start_date").val();
		var edate = $("#end_date").val();
		var type = $("#type").val();
		if(sdate=="" || edate==""){
		     alert("请选择时间段！");
		}
		$.post("${contextPath}/oa/consultant_client_reception_list.json", {
		"sdate":sdate,"edate":edate,"type":type
	}, function(ms) {
			var name = ms.name;
			$("#type").val(ms.type);
			if(name != ""){
				//alert("下载成功,请到d盘查看文件："+name);
				var url = "http://120.55.241.58//mydata//uploadtea//xls//"+name;
				location.href = url;
				/*var aLink = document.createElement('a');
	    		var evt = document.createEvent("HTMLEvents");
	    		evt.initEvent("click", false, false);
	    		aLink.download = name;
	    		aLink.href = url;
	    		aLink.dispatchEvent(evt);*/
			}
			
    		
	});	
}

function downent(stu){
		var sdate = $("#start_date").val();
		var edate = $("#end_date").val();
		var type = $("#type").val();
		if(sdate=="" || edate==""){
		     alert("请选择时间段！");
		}
		$.post("${contextPath}/oa/consultant_client_reception_list.json", {
		"sdate":sdate,"edate":edate,"type":type,"stu":stu
	}, function(ms) {
			var name = ms.name;
			$("#type").val(ms.type);
			var url = "http://120.55.241.58//mydata/uploadtea/xls/"+name;
			var aLink = document.createElement('a');
    		var evt = document.createEvent("HTMLEvents");
    		evt.initEvent("click", false, false);
    		aLink.download = name;
    		aLink.href = url;
    		aLink.dispatchEvent(evt);
	});	
}

</script>
</head>

<body>
<input type="hidden" id="traId" value="">
	<div id="home_link">
		<ul>
			<li></li>
			<li>&gt;</li>
			<li>咨询师模块</li>
			<li>&gt;</li>
			<li class="current"></li>
		</ul>
	</div>
	<div id="container">
		<div id="title"></div>
		<table class="simple_table" rel="nohover" style="min-width: 750px;">
			<tr>
				<td><label for="start_date">起始日期：</label>
				<input type="text" name="start_date" id="start_date" size="15"value="${sdate}" rel="DATE::Y-m-d" /> 
				<label for="end_date">终止日期：</label><input type="text"name="end_date" id="end_date" size="15" value="${edate}" rel="DATE::Y-m-d" />
				<select id="type">
					<option value="1">接待日期</option>
				</select>
				<input type="button" value=" 查 询 " onclick="starquery()" />
				<input type="button" value="下载接待数据" onclick="download()" />
				<input type="button" value="下载测评数据" onclick="downent(1)" />
			</tr>
		</table>
		<table>
			<tr class="fields">
				<th width="150">客户姓名</th>
				<th width="100">接待日期</th>
				<th>接待老师</th>
				<th>联系方式</th>
				<th>测评中心</th>
				<th>继续跟踪价值</th>
				<th width="250">测评完成情况</th>
				<th>操作</th>
			</tr>
			<#if list??>
				<#list list as list>
					<tr class="even_row">
						<td align="center" id="${list.keyname}" name="${list.keyname}" class="stress">${list.nickname}<em class="valid">（有效）</em></td>
						<td align="center">${list.gtime?date}</td>
						<td align="center">${list.receptionns}</td>
						
						<td align="center">
						<#if list.phlist??>
							<#list list.phlist as phlist>
							<a title="<#if phlist.phone!="">电话：${phlist.phone}</#if> <#if list.qq!="">QQ：${list.qq}</#if> <#if list.weixin!="">微信：${list.weixin}</#if> <#if list.email!="">邮箱：${list.email}</#if> " id="${list.id}">
							<#assign phone1 = "${phlist.phone}">
							<#if phlist.name=="爸爸" || phlist.name=="妈妈">
								<em class="caption">电话：</em>${phlist.phone}
								<em class="caption">关系：</em>${phlist.name}</br>
							<#elseif phlist.guanxi!="">
								<em class="caption">电话：</em>${phlist.phone}
								<em class="caption">关系：</em>${phlist.guanxi}</br>
							<#else>
								<em class="caption">电话：</em>${phlist.phone}
								<em class="caption">关系：</em>${phlist.name}</br>
							</#if>
							</a>
     						</#list>
     						<#else>
						<a title="<#if list.phone!="" && list.phone?contains('[]')==false>电话：${list.phone}</#if> <#if list.qq!="">QQ：${list.qq}</#if> <#if list.weixin!="">微信：${list.weixin}</#if> <#if list.email!="">邮箱：${list.email}</#if> " id="${list.id}">
     						<#if list.phone!="" && list.phone?contains('[]')==false>
     						<em class="caption">电话：</em>${list.phone}
     						<#elseif list.qq!="">
     						<em class="caption">QQ:</em>${list.qq}
     						<#elseif list.email!="">
     						<em class="caption">email:</em>${list.email}
     						</#if>
     						</a>
     					  </#if>
     					</td>
						
						<td align="center">${list.regionns}</td>
						<td>
							<#if list.worth=="1">
								维持客情
							<#elseif list.worth=="2">
								长期跟踪
							<#elseif list.worth=="3">
								计划跟踪
							<#elseif list.worth=="4">
								随后回访跟踪
							<#elseif list.worth=="5">
								必须跟踪争取
							<#elseif list.worth=="6">
								已成交</br>
								实际金额：<span class="stress">${list.money}</span>
							</#if>
						</td>
						<td>
						   <#if list.smlist??>
						   	<#list list.smlist as ms>
						   	  <#if ms.price!= "" || ms.moneylog!= "">
								<div class="rect" style="margin:2px 0 2px;">
								<b>学员：</b>
								<span class="stress">${ms.testuser}</span><br>
								<div><b>报价：</b>${ms.price}</div>
								<div><b>金额：</b>${ms.moneylog}</div>
						 		</div>
						 	</#if>	
							</#list>
						   </#if>
							
						</td>
						<td align="center">
						<#if webutil.getCookieUser().nickname=="超级管理员">
						<a rel="DEL::${list.keyname}">删除</a> - 
						</#if>
						<a href="${contextPath}/index/consultant_client.htm?keyname=${list.client}">跟踪</a> - 
						<a href="${contextPath}/index/system_reception_view.htm?keyname=${list.keyname}">详细信息</a></td>
					</tr>
					<tr id="__TRACKING_LIST${list.id}" style="display:none">
	            		<td colspan="10" class="trackinglst" id="trackList${list.id}">
	            		</td>
	            	</tr>
				</#list>
			</#if>
		</table>
		<div class="page_num" style="text-align:right;margin: 0px auto 0px auto;padding-right: 20px;">共<#if list??>${list?size}<#else>0</#if>条记录</div>
	</div>
	<div id="pager" style="width: 849px;">
	<ul id="pagination">
		<#if page??>
		<#if page.pagetotal?? && page.pagetotal!="0">
	<#assign pagetotal = page.pagetotal>
	<#else>
	<#assign pagetotal = 1>
	</#if>
			<#if page.currpage??>
	<#assign currpage = page.currpage>
	<#else>
	<#assign currpage = 1>
	</#if>
				<#if currpage==1 >
					<li class="previous-off">上一页</li>
					<#else>
					<li class="previous"><a href="${contextPath}/index/system_reception_list.htm?currPage=${currpage-1}&knickname=${knickname}&snickname=${snickname}&rkey=${rkey}&worth=${worth}&phone=${phone}&qq=${qq}&source=${source}&email=${email}&stnickname=${stnickname}">上一页</a></li>
					</#if>
					
		<#if pagetotal<=11>
			<#list 1..pagetotal as index_up>  
	           <#if currpage==index_up > 
	           		<li class="current">${index_up}</li>
	           <#else>
	           		<li><a href="${contextPath}/index/system_reception_list.htm?currPage=${index_up}&knickname=${knickname}&snickname=${snickname}&rkey=${rkey}&worth=${worth}&phone=${phone}&qq=${qq}&source=${source}&email=${email}&stnickname=${stnickname}">${index_up}</a></li>  
	           </#if>  
			</#list>  
		<#else>
			<#if currpage<=8 >
				<#list 1..9 as index_up>  
	           	<#if currpage==index_up >  
	            	<li class="current">${index_up}</li>
	           	<#else>  
	               <li><a href="${contextPath}/index/system_reception_list.htm?currPage=${index_up}&knickname=${knickname}&snickname=${snickname}&rkey=${rkey}&worth=${worth}&phone=${phone}&qq=${qq}&source=${source}&email=${email}&stnickname=${stnickname}">${index_up}</a></li> 
	           	</#if>
	           	</#list>  
	           	<li>...</li>
	           	<li><a href="${contextPath}/index/system_reception_list.htm?currPage=${pagetotal}&knickname=${knickname}&snickname=${snickname}&rkey=${rkey}&worth=${worth}&phone=${phone}&qq=${qq}&source=${source}&email=${email}&stnickname=${stnickname}">${pagetotal}</a></li>  
				
			<#elseif (currpage>= 9 && currpage<pagetotal-7)  >	
				<li><a href="${contextPath}/index/system_reception_list.htm?currPage=1&knickname=${knickname}&snickname=${snickname}&rkey=${rkey}&worth=${worth}&phone=${phone}&qq=${qq}&source=${source}&email=${email}&stnickname=${stnickname}">1</a></li>  
				<li>...</li>
				<#list currpage-3..currpage+3 as index_up>  
	           	<#if currpage==index_up >  
	             <li class="current">${index_up}</li>
	           	<#else>  
	               <li><a href="${contextPath}/index/system_reception_list.htm?currPage=${index_up}&knickname=${knickname}&snickname=${snickname}&rkey=${rkey}&worth=${worth}&phone=${phone}&qq=${qq}&source=${source}&email=${email}&stnickname=${stnickname}">${index_up}</a></li>  
	           	</#if>
	           	</#list>
				<li>...</li>
	           	<li><a href="${contextPath}/index/system_reception_list.htm?currPage=${pagetotal}&knickname=${knickname}&snickname=${snickname}&rkey=${rkey}&worth=${worth}&phone=${phone}&qq=${qq}&source=${source}&email=${email}&stnickname=${stnickname}">${pagetotal}</a></li>   
			<#else>
				<li><a href="${contextPath}/index/system_reception_list.htm?currPage=1&knickname=${knickname}&snickname=${snickname}&rkey=${rkey}&worth=${worth}&phone=${phone}&qq=${qq}&source=${source}&email=${email}&stnickname=${stnickname}">1</a></li> 
				<li>...</li>
				<#list pagetotal-8..pagetotal as index_up>  
	           	<#if currpage==index_up >  
	             <li class="current">${index_up}</li>
	           	<#else>  
	               <li><a href="${contextPath}/index/system_reception_list.htm?currPage=${index_up}&knickname=${knickname}&snickname=${snickname}&rkey=${rkey}&worth=${worth}&phone=${phone}&qq=${qq}&source=${source}&email=${email}&stnickname=${stnickname}">${index_up}</a></li> 
	           	</#if>
				</#list>  
			</#if>
			
		</#if> 
		<#if currpage==pagetotal >
		 	<li class="previous-off">下一页</li>
		<#else>
			<li class="previous"><a href="${contextPath}/index/system_reception_list.htm?currPage=${currpage+1}&knickname=${knickname}&snickname=${snickname}&rkey=${rkey}&worth=${worth}&phone=${phone}&qq=${qq}&source=${source}&email=${email}&stnickname=${stnickname}">下一页</a></li>
		</#if>
		<li class="pageinfo">共${page.total}条记录</li>
	</#if>
	</ul>
	</div>
	<div class="emptyline"></div>
</body>
</html>